<%@ page pageEncoding="utf-8" %>
<%@include file="/commons/taglibs.jsp" %>
<!DOCTYPE html>
<html>
<fmt:bundle basename="res">
<head>
    <meta charset="utf-8">
    <title><fmt:message key='lb'/></title>
    <jsp:include page="/WEB-INF/commons/commons-header.jsp" flush="true"/>
</head>
<body>

<div class="layui-fluid">
    <div class="layui-card">
        <div class="layui-form layui-card-header layuiadmin-card-header-auto">

            <div class="layui-form-item">
                <form name="totalForm" id="totalForm" action="${web_domain}/mall/seckill/list" method="get">

                    <div class="layui-inline">
                        <label class="layui-form-label"><fmt:message key='mscc'/></label>
                        <div class="layui-input-inline">
                            <input type="text" name="seckillSession.name" placeholder="<fmt:message key='qsrmscc'/>" value="${params.seckillSession.name}" autocomplete="off" class="layui-input">
                        </div>
                    </div>

                    <div class="layui-inline">
                        <button class="layui-btn layui-btn-sm layuiadmin-btn-list" id="search"><i class="layui-icon layui-icon-search layuiadmin-button-btn"></i> <fmt:message key='ss'/></button>
                    </div>
                </form>
            </div>
        </div>

    </div>

    <div class="layui-card">
        <div class="layui-field-box layui-form">

            <%--<c:if test="${params.status eq 1 || params.status eq 4 || params.status eq 5}">--%>
            <%--<a href="javascript:void(0);" class="layui-btn layui-btn-sm layui-btn-warm" id="applysPutaway"><i class="layui-icon">&#xe605;</i> 批量申请上架</a>--%>
            <%--</c:if>--%>
            <%----%>
            <%--<c:if test="${params.status eq 3}">--%>
            <%--<a href="javascript:void(0);" class="layui-btn layui-btn-sm layui-btn-danger" id="soldouts"><i class="layui-icon">&#x1006;</i> 批量下架</a>--%>
            <%--</c:if>--%>
            <%----%>

            <div class="layui-tab layui-tab-brief" lay-filter="docDemoTabBrief">
                <ul class="layui-tab-title">
                    <li
                            <c:if test="${params.status eq 0}">class="layui-this"</c:if> >
                        <a href="${web_domain}/mall/seckill/list"
                           <c:if test="${params.status eq 0}">style="color: rgb(0, 150, 136)"</c:if> ><fmt:message key='qb'/></a>
                    </li>
                    <li <c:if test="${params.status eq 2}">class="layui-this"</c:if>>
                        <a href="${web_domain}/mall/seckill/list?status=2" <c:if test="${params.status eq 2}">style="color: rgb(0, 150, 136)"</c:if>><fmt:message key='shz'/></a>
                    </li>
                    <li <c:if test="${params.status eq 3}">class="layui-this"</c:if>>
                        <a href="${web_domain}/mall/seckill/list?status=3" <c:if test="${params.status eq 3}">style="color: rgb(0, 150, 136)"</c:if>><fmt:message key='ysj'/></a>
                    </li>
                    <li <c:if test="${params.status eq 4}">class="layui-this"</c:if>>
                        <a href="${web_domain}/mall/seckill/list?status=4" <c:if test="${params.status eq 4}">style="color: rgb(0, 150, 136)"</c:if>><fmt:message key='shbtg'/></a>
                    </li>
                </ul>
            </div>

            <table class="layui-table" lay-size="sm">
                <thead>
                <th width="5%"><input id="checkboxs" type="checkbox" value="${item.id}" lay-ignore lay-skin="primary"/></th>
                <th><fmt:message key='mscc'/></th>
                <th><fmt:message key='mssj'/></th>
                <th><fmt:message key='spsl'/></th>
                <th><fmt:message key='zt'/></th>
                <th><fmt:message key='hdzt'/></th>
                <th><fmt:message key='cz'/></th>
                </thead>
                <c:forEach items="${page.result}" var="item" varStatus="status">
                    <tr>
                        <td><input type="checkbox" value="${item.id}" class="feijin-check" lay-ignore lay-skin="primary"/></td>
                        <td>${item.seckillSession.name }</td>
                        <td>${item.seckillSession.seckillTime } ${item.seckillSession.seckillBeginTime } ~ ${item.seckillSession.seckillEndTime }</td>
                        <td>${item.goodsCount }</td>
                        <td>
                            <c:choose>
                                <c:when test="${item.status eq 1}"><fmt:message key='dtj'/></c:when>
                                <c:when test="${item.status eq 2}"><fmt:message key='shz'/></c:when>
                                <c:when test="${item.status eq 3}"><fmt:message key='ysj'/></c:when>
                                <c:when test="${item.status eq 4}"><fmt:message key='shbtg'/></c:when>
                                <c:when test="${item.status eq 5}"><fmt:message key='xj'/></c:when>
                            </c:choose>
                        </td>
                        <td>
                            <c:choose>
                                <c:when test="${item.isValidity eq 1}"><fmt:message key='wks'/></c:when>
                                <c:when test="${item.isValidity eq 2}"><fmt:message key='hdks'/></c:when>
                                <c:when test="${item.isValidity eq 3}"><fmt:message key='hdjs'/></c:when>
                            </c:choose>
                        </td>
                        <td>
                            <div class="layui-btn-container">

                                <a href="javascript:void(0);" data-id="${item.id}" class="layui-btn layui-btn-xs feijin-detail"><fmt:message key='ck'/></a>

                                <c:choose>
                                    <c:when test="${item.status eq 2}">
                                        <a href="javascript:void(0);" data-id="${item.id}" class="layui-btn layui-btn-danger layui-btn-xs feijin-process"><fmt:message key='sh'/></a>
                                    </c:when>
                                </c:choose>


                            </div>
                        </td>
                    </tr>
                </c:forEach>
            </table>
            <jsp:include page="/commons/page.jsp" flush="true"/>
        </div>
    </div>

</div>

<script>

    $(function () {

        //全选反选
        $("#checkboxs").click(function () {
            if (this.checked) {
                $(".feijin-check:checkbox").prop("checked", true);
            } else {
                $(".feijin-check:checkbox").prop("checked", false);
            }
        });


        layui.use(['form', 'laydate'], function () {

            var form = layui.form;
            var laydate = layui.laydate;

        });

        //查看详情
        $(".feijin-detail").click(function () {

            var id = $(this).attr("data-id");

            layer.open({
                type: 2
                , title: '<fmt:message key='ckxq'/>'
                , content: '${web_domain}/mall/seckill/' + id + '/detail'
                , maxmin: true
                , area: ['97%', '97%']
                , btn: ['<fmt:message key='fh'/>']
            });
        });

        //审核
        $(".feijin-process").click(function () {

            var id = $(this).attr("data-id");

            layer.open({
                type: 2
                , title: '<fmt:message key='shmshd'/>'
                , content: '${web_domain}/mall/seckill/' + id + '/process'
                , maxmin: true
                , area: ['97%', '97%']
                , btn: ['<fmt:message key='bc'/>', '<fmt:message key='qx'/>']
                , yes: function (index, layero) {
                    var submit = layero.find('iframe').contents().find("#submit");
                    submit.click();
                }
            });
        });

    });
</script>
</body>
</fmt:bundle>
</html>
